#include"acoral.h"
#include"driver.h"
#include"dma.h"
#if 0
static dma_channel_t dma_channel[MAX_DMA_CHANNEL];


acoral_32 dma_open(void)
{

}

acoral_32 dma_config(acoral_u32 cmd,void *data,acoral_time time_out)
{
	acoral_32 ret;
	dma_para_t *dma_para = (dma_para_t *)data;
	if (NULL == data){
		return -1;
	}
	switch (cmd){
		case CMD_DMA_REQUEST:
		
			if (DMA_IS_HWTRIG == data->hw_sw){
				ret = RequestDMA(data->attr, data->mode);
			
			}else if (DMA_IS_SWTRIG == data->hw_sw){
				ret = RequestDMASW(data->attr, data->mode);
			
			}else{
				acoral_prints("dma config data error!\n");
				ret = -2;
			}
		break;
		
		case CMD_DMA_SET:
			ret = SetDMA(data->attr, data->src_addr, data->dst_addr, data->len);
		break;
		
		case CMD_DMA_START:
			ret = StartDMA(data->attr);
		break;
		
		case CMD_DMA_STOP:
			ret = StopDMA(data->attr);
		break;
		
		default:
			acoral_prints("dma cmd is`t right\n");
			ret = -3;
		break;
	}
	
	return ret;
}

acoral_32 dma_init()
{

}

static acoral_dev_ops_t dma_ops = 
{
dma_open,
NULL,
NULL,
dma_config,
NULL,
dma_init
};

void dma_dev_init(){
	acoral_drv_register(&dma_ops,"dma");
	acoral_prints("register dma !\n");
}


#endif